//
//  Precentage.m
//  Deep_Breath
//
//  Created by rimi on 15/9/15.
//  Copyright (c) 2015年 LiuCong. All rights reserved.
//

#import "Precentage.h"



#define WIDTH 375.0
#define HEIGTH 667.0

#define SCREEN_W [UIScreen mainScreen].bounds.size.width
#define SCREEN_H [UIScreen mainScreen].bounds.size.height
@implementation Precentage

- (CGRect)initWithRect:(CGRect)rect {
    CGPoint center = CGPointMake(rect.origin.x + rect.size.width / 2, rect.origin.y + rect.size.height / 2);
    CGPoint currentCenter = [self initWithCenter:center];
    CGRect currentRect;
    currentRect.size.width = rect.size.width * [self LcFlexibleWidth];
    currentRect.size.height = rect.size.height * [self LcFlexibleHeight];
    currentRect.origin.x = currentCenter.x - currentRect.size.width / 2;
    currentRect.origin.y = currentCenter.y - currentRect.size.height / 2;
    return currentRect;
}

- (CGFloat)LcFlexibleWidth {
    return SCREEN_W / WIDTH;
}
- (CGFloat)LcFlexibleHeight {
    return SCREEN_H / HEIGTH;
}

- (CGPoint)initWithCenter:(CGPoint)center {
    return CGPointMake(center.x * [self LcFlexibleWidth], center.y * [self LcFlexibleHeight]);
}


- (CGSize)initWithSize:(CGSize)size
{
    return CGSizeMake(size.width * [self LcFlexibleWidth], size.height * [self LcFlexibleWidth]);
}
@end
